<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>

<html>
   <head>
	   <script>
		  function processDisplay(action) {
     		document.getElementById("displayblock").innerHTML = '';
		    var url = '/lwf/homonyms.do?action=';
		    if(action == 'next') {
		       url = url + 'shownext';
		    }
		    else if(action == 'previous') {
		       url = url + 'showprevious';
		    }
		    else {
		       url = url + 'newdisplay';
		    }
            var datarows = trimSpaces(getComboSelected('disprows'));

		    if(datarows.length != 0) {
   		        url = url + '&disprows=' + datarows;
   		        if(isElementExists('gradeLevel')) {
   		            url = url + '&gradeLevel=' + trimSpaces(getComboSelected('gradeLevel'));
   		        }
   		        //alert(url);
   		        retrieveURL(url, 'displayblock');
		    }
		    else {
		       alert('Please select the choice');
		    }
		  }
      </script>
   </head>
   <html:form action="/homonyms" >
   
   <table border="0" align="center" width="75%" bordercolor="red">
       <tr>
           <td align="center">
              <table width="100%" border="0">
                 <bean:define id="datarows" name="wdform" property="datarows" type="java.util.List" />
                 <bean:define id="levels"   name="wdform" property="levels" type="java.util.List" />
                 <tr>
                    <td class="formLabel" width="35%" nowrap>
                        Select Number of words to display
                    </td>
                    <td width="2%">&nbsp;</td>
                    <td width="10%">
	                  <html:select property="disprows" onchange="processDisplay('newdisplay')">
	                      <html:options property="datarows"/>
	                  </html:select>
                    </td>
                    <logic:equal name="wdform" property="displayLevel" value="false">
                    <td colspan="4">&nbsp;</td>                    
                    </logic:equal>
                    <logic:equal name="wdform" property="displayLevel" value="true">
                    <td class="formLabel" width="30%">Select Level</td>
                    <td width="2%">&nbsp;</td>
                    <td width="10%">
	                  <html:select property="gradeLevel" onchange="processDisplay('newdisplay')">
	                      <html:options property="levels"/>
	                  </html:select>
                    </td>
                    <td width="11%">
                       <img src="<%=request.getContextPath()%>/image/button/start.gif" onclick="processDisplay('newdisplay')"/>
                    </td>
                    </logic:equal>
                 </tr>
              </table>
           </td>
       </tr> 
       <tr>
           <td><hr></td>
       </tr> 
       <tr>
           <td>
               <table border="0" width="100%">
                  <tr>
                      <td align="center">
                         <span id="displayblock"></span>
                      </td>
                  </tr>                  
               </table>
           </td>
       </tr> 
   </table>  
   </html:form>
</html>